const i18n = new VueI18n({
    locale: 'zh', // 设置默认
    messages
});

var em = new Vue({
    el: main,
    i18n,
    data: {
        leftNum: 2, //用来判断左侧菜单的样式，选取0位第一个
        menuLefts: [{ //构建的左侧菜单选项
            title: "homeResultDataJsp.Simulation_data",
            url: "../img/home/siteMonitoring.png"
        }, {
            title: "homeResultDataJsp.Rendering_data",
            url: "../img/home/concentration.png"
        }, {
            title: "homeResultDataJsp.Dynamic_data",
            url: "../img/home/dynamic_dataS.png"
        }],
        //下拉框选项
        dateValue: null,    //日期数据
        tierOptionValue: "1",        //层数选项
        siteTypeOptionValue: "",    //类别选项
        fileOptionValue: "",         //文件
        siteOptionValue: "DM2",     //观测点数据
        //数据表格
        tableData: null, // 表格数据
        pageCount: 0,
        pageNo: 0,
        allData: null,
        //统计图
        echartsOption: null,
        echartBegtime: "",   //统计图开始时间
        echartEndtime: "",   //统计图结束时间
        myChart: null,//char本体
        echartShow: true,    //统计图是否显示
        imageTimeValue: "",// 图片的时间

        propertyInfo: null,  //属性类别实体
        fileInfo: null,  //文件实体
        //图片和时间轴
        imageSrc: "",                    //文件图像渲染URL
        startDateDisabled: {},           //限制日期开始
        timeDisabled: {},             //限制日期结束
        fileOptionOne: null,              //所选文件的实体
        timeValueBegin: 0,
        timeEndHour: 48,             //时间总量 因为
        timePlayValue: 0,                //这个标识就按照开始时间后多小小时来算
        timePage: 1,         //第0页
        marks: {},  //标识
        timePlayTitle: "Play",
        iconData: "el-icon-video-play",
        palyFlose: 0,        //这个用来判断Play按钮的暂停
        onePlayFlose: 0,     //这个用循环第一次
        imagTitle: "",
        locals18n: "",
        oneMonthTime: "",
        //server集合
        layerChangeVisible: false,
        fileArray: null,
        checkList: [],
        fileSbwID: "",
        beginDate: "",
        endDate: "",
        //是否为动态数据
        dynamicVisible:false,
        intervalFun:null,
    },
    created: function () {
        //取消loading
        this.openLoading();
        this.locals18n = this.common.Initial();
        this.$i18n.locale = this.locals18n;

        //初始化图层控制的
        this.$http.get('/readMap/findFileType.do?type=his', {emulateJSON: true}).then(function (res) {
            var fubiao = {id: "2", fileName: "浮标数据"};
            this.fileArray = res.data;
            this.fileArray.push(fubiao);
        });

        this.leftSwitch(2);

    }, watch: {
        'fileInfo': { //监控文件选择
            handler(newValue, oldValue) {
                clearInterval(em.intervalFun);
                this.checkList = [];
                this.beginDate = "";
                this.endDate = "";
                //设置 时间轴开始时间
                this.timeValueBegin = newValue.strDate;
                //设置 标题
                document.getElementById("echartSpan").innerText = "(  " + this.fileInfo.fileRange + "  )          " + this.fileInfo.fileName;
                //设置日期禁止选项
                this.startDateDisabled.disabledDate = function (time) {
                    return time.getTime() < newValue.strDate || (time.getTime() > newValue.endDate);
                };
            }
        }, 'fileOptionValue': { //监控文件选择
            handler(newValue, oldValue) {
                setTimeout("em.loadData();", 1000);
            }
        }, 'timePlayValue': {
            handler(newValue, oldValue) {
                // console.log(newValue);
                //这块应该开受限制
                if (newValue < 1) {
                    //这个是上一页
                    this.timePage--;
                }
                if (newValue > 12) {
                    // 这个是下一页
                    this.timePage++;
                }
                // console.log(newValue);
                if (this.timeValueBegin != 0 && newValue != 13) {
                    var timeTemp = this.timeValueBegin + ((newValue - 1) * 1000 * 60 * 60 + ((this.timePage - 1) * 12 * 1000 * 60 * 60));
                    this.loadImaget(timeTemp);
                }
            }
        }, 'timePage': {
            handler(newValue, oldValue) {
                var pageMax = this.timeEndHour / 12;
                // console.log("变化次数"+newValue+";"+oldValue);
                if (newValue < 1) {
                    this.timePage = 1;
                    this.timePlayValue = 1;
                } else if (newValue > pageMax) {
                    this.timePage = pageMax;
                    this.timePlayValue = 12;
                } else {
                    if (oldValue < newValue) {
                        this.timePlayValue = 1;
                    }
                }
                this.timeMarks();
            }
        }
    }, methods: {
        leftSwitch(index) { //上方菜单栏切换事件
            this.leftNum = index;
            for (i = 0; i < this.menuLefts.length; i++) {
                this.menuLefts[i].url = this.menuLefts[i].url.replace("S.png", ".png");
            }
            this.menuLefts[index].url = this.menuLefts[index].url.replace(".png", "S.png");
            //清空下拉框之类的信息
            // this.fileOptionValue = "";
            // this.siteTypeOptionValue = "";
            document.getElementById("echartSpan").innerText = "";


            switch (index) {
                case 0:
                case 2:
                    //统计图
                    this.timeValueBegin = 0;
                    //显示统计图
                    this.echartShow = true;
                    // this.loadSiteType();
                    document.getElementById("backGroundImage").style.height = "480px";
                    //东西变的暂停
                    this.timePlayTitle = "Play";
                    this.iconData = "el-icon-video-play";
                    this.palyFlose = 0;
                    document.getElementById("eChartsDiv").style.display = "block";
                    break;
                case 1:
                    // 图片
                    document.getElementById("eChartsDiv").style.display = "none";
                    //隐藏统计图
                    this.echartShow = false;
                    //下拉框数据
                    document.getElementById("backGroundImage").style.height = document.body.clientHeight - 50 + "px";
                    if (this.onePlayFlose == 0) {
                        this.onePlayFlose = 1;
                        this.timeWhile();
                    }
                    // this.timePlayValue = 0;
                    break;
            }

            //新加入动态数据
            if(index==2){
                //隐藏对比数据+删除 one_month
                this.dynamicVisible=true;
                //还得刷新数据
                this.loadData();
            }else if(index==0){
                this.dynamicVisible=false;
                this.loadData();
            }else{
                this.dynamicVisible=false;
            }
            clearInterval(this.intervalFun);
           
        },
        showNot(menu) {
            //是否多选框的数据
            if (this.fileInfo != null) {
                if (this.fileInfo.id == menu.id) {
                    return false;
                }//如果是 one_month 的话 ，也不展示
                if (this.fileInfo.id == "1") {
                    if (menu.fileName.indexOf("efdc") != -1 || menu.id == this.fileSbwID || menu.id == "2") {
                        return false;
                    }
                }
            }
            if (menu.id == "1") {
                return false;
            }
            return true;
        },
        changeCharts(checked, item) {
            // 修改图层显示数据
            if (checked) {
                //添加
                if (item.id == '2') {
                    //这个是浮标数据
                    var beginRtime = "";
                    var endRtime = "";

                    if (this.dateValue == null) {
                        beginRtime = this.echartBegtime;
                        endRtime = this.echartEndtime;
                    } else {
                        beginRtime = this.common.getTime(this.dateValue[0], "Y");
                        endRtime = this.common.getTime(this.dateValue[1], "Y");
                    }
                    this.$http.get('/hardware/getHarewaredData.do?pre=' + this.siteTypeOptionValue + "&begDate=" + beginRtime + "&endDate=" + endRtime, {emulateJSON: true}).then(function (res) {
                        if (res.data.length != 0) {
                            var datasChart = this.fromatTimeDataGC(res.data);
                            // console.log(datasChart);
                            var messageNoData = "暂未根据目前条件查询到观测数据";
                            // var observation_dat = messages.zh.homeResultDataJsp.observation_dat;
                            this.addElseData(datasChart, "浮标数据", "scatter", this.randomColor())
                        } else {
                            this.$message({
                                message: '尚未查询到数据',
                                type: 'error'
                            });
                        }
                    });


                } else {
                    this.$http.get('/readMap/queryHis.do?languageType=' + this.locals18n + '&type=' + this.siteTypeOptionValue + "&trie=" + this.tierOptionValue + "&fileID=" + item.id + "&site=" + this.siteOptionValue + "&beginTime=" + this.beginDate + "&endTime=" + this.endDate, {emulateJSON: true}).then(function (res) {
                        //加载数据
                        var datasChart = this.fromatTimeData(res.data);
                        this.addElseData(datasChart, item.fileName, "line", this.randomColor());
                    });
                }
            } else {
                //删除
                var nameData = this.echartsOption.legend.data;
                for (var i = 0; i < nameData.length; i++) {
                    if (nameData[i] == item.fileName) {
                        nameData.splice(i, 1);
                    }
                }
                this.echartsOption.legend.data = nameData;

                var serverData = this.echartsOption.series;
                // console.log(serverData);
                for (var i = 0; i < serverData.length; i++) {
                    if (serverData[i].name == item.fileName) {
                        serverData.splice(i, 1);
                    }
                }
                // console.log(serverData);
                this.echartsOption.series = serverData;
                // console.log(this.echartsOption.legend.data);
                // console.log(this.echartsOption)
                //this.echartsOption.legend.data.push(observation_dat);
                // this.echartsOption.series.push(addserver);
                this.myChart.clear();
                this.myChart.setOption(this.echartsOption);
            }
        },
        loadData() {   //统计图模块通过下拉框查询数据
            //打开加载条
            this.openLoading();
           try{
               clearInterval(em.intervalFun);
           }catch (e) {

           }
            //需要清空一下数据
            this.checkList = [];
            this.echartsOption = null;
            if (this.echartShow) {
                //统计图表格
                if(this.dynamicVisible){
                    //需要动态数据

                    this.$http.get('/readMap/queryHis.do?languageType=' + this.locals18n + '&type=' + this.siteTypeOptionValue + "&trie=" + this.tierOptionValue + "&fileID=" + this.fileOptionValue + "&site=" + this.siteOptionValue +"&dyMonth=1", {emulateJSON: true}).then(function (res) {
                        this.closeLoading();
                        //先初始化
                        var chushiArray=[];
                        var i=0;
                        for (let j = 0; j < 3 * 30; j++) {
                            i++;
                            chushiArray.push(res.data[j])
                        }
                        this.generateDate(chushiArray);
                        //添加最后的数据
                        var dataJson=res.data;
                        var now = new Date(dataJson[dataJson.length-1].hisTime);
                        var value = dataJson[dataJson.length-1].hisValue;
                        var lastData = [];
                        lastData.push([now, value]);

                        var lastDataServer={
                            name: "0",
                            type: 'line',
                            showSymbol: false,
                            hoverAnimation: false,
                            data: lastData,
                            color: ['#e42222'],
                        };

                        this.echartsOption.series.push(lastDataServer);
                        console.log(this.echartsOption);

                        this.myChart.setOption(this.echartsOption);

                        em.intervalFun = setInterval(function(){
                            //切换到别处就停止
                            if(em.dynamicVisible==false){
                                clearInterval(em.intervalFun);
                                return;
                            }
                            if(i <= (res.data.length-1)){

                                for (let j = 0; j < 2; j++) {
                                    var needData=res.data[i];
                                    i++;
                                    // em.echartsOption.series[0].data.shift();
                                    em.echartsOption.series[0].data.push([new Date(needData.hisTime),needData.hisValue]);
                                }
                               // console.log(em.echartsOption);
                                // console.log(em.echartsOption);
                                em.myChart.setOption(em.echartsOption);

                                chushiArray.push(needData);
                                em.pageCount=chushiArray.length;
                                em.tableData = em.fromatTableData(chushiArray, 1);

                            }else{
                                clearInterval(em.intervalFun);
                                return;
                            }
                            i++;

                        },500);

                    });

                }else{
                    //不需要动态的数据
                    if (this.fileOptionValue != "" && this.siteTypeOptionValue != "" && this.tierOptionValue != "" && this.siteOptionValue != "") {
                        if (this.dateValue != null) {
                            this.beginDate = this.common.dateToString(this.dateValue[0]);
                            this.endDate = this.common.dateToString(this.dateValue[1]);
                        }
                        if (this.fileOptionValue == 1) {
                            //如果等于1 就是one_month 数据
                            this.$http.get('/readMap/findOneMonthThreeData.do?languageType=' + this.locals18n + '&type=' + this.siteTypeOptionValue + "&trie=" + this.tierOptionValue + "&fileID=" + this.fileOptionValue + "&site=" + this.siteOptionValue + "&beginTime=" + this.beginDate + "&endTime=" + this.endDate, {emulateJSON: true}).then(function (res) {

                                console.log(this.siteTypeOptionValue);
                                if (res.data.sbw.length != 0) {
                                    this.fileSbwID = res.data.sbw[0].fileid;
                                    //加载三种数据
                                    this.oneMonthTime = res.data.time;
                                    this.generateDate(res.data.sbw);



                                    var datasChartHWD = this.fromatTimeDataGC(res.data.hwd);
                                    this.addElseData(datasChartHWD, "浮标数据", "scatter", "#0cbdd7");

                                    var datasChartEdfc = this.fromatTimeData(res.data.edfc);
                                    this.addElseData(datasChartEdfc, "同化数据", "line", "#67C23A");




                                } else {
                                    this.$message({
                                        message: '尚未同时查询到数据，请切换文件查询',
                                        type: 'error'
                                    });
                                } this.closeLoading();
                            });
                        } else {
                            //查询his 里面的数据
                            this.$http.get('/readMap/queryHis.do?languageType=' + this.locals18n + '&type=' + this.siteTypeOptionValue + "&trie=" + this.tierOptionValue + "&fileID=" + this.fileOptionValue + "&site=" + this.siteOptionValue + "&beginTime=" + this.beginDate + "&endTime=" + this.endDate, {emulateJSON: true}).then(function (res) {
                                this.closeLoading();
                                this.generateDate(res.data);
                            });
                        }
                    } else {
                        this.$message({
                            message: '请选择',
                            type: 'error'
                        });
                    }
                }


            } else {
                if (this.fileOptionValue != "" && this.imageTimeValue.length != 0 && this.siteTypeOptionValue != "") {
                    //这里查询后台数据并返回到前端
                    var timeTemp = new Date(this.imageTimeValue).valueOf();  //转化为时间戳
                    this.reloadImage();  //重置
                    //返回图片
                    this.loadImaget(timeTemp);
                }
            }
        },
        generateDate(data) {
            //加载数据
            try {
                this.pageCount = data.length;
                this.allData = data;
                this.nowUnit = data[0].hisUnit;
                var datasChart = this.fromatTimeData(data);
                var beginDate = this.common.dateToString(datasChart[0][0]);
                var endDate = this.common.dateToString(datasChart[datasChart.length - 1][0]);
                this.loadChart(datasChart, beginDate, endDate);
                //表格数据
                this.tableData = this.fromatTableData(data, 1);
                //取消加载按钮

            } catch (e) {
                this.$message({
                    message: '尚未查询到数据',
                    type: 'error'
                });
            }
            this.closeLoading();

        },
        fromatTimeData(date) {  //格式化数据到统计图
            var data = [];
            for (let i = 0; i < date.length; i++) {
                var now = new Date(date[i].hisTime);
                var value = date[i].hisValue;
                var jjson = [now, value];
                data.push(jjson);
            }
            return data;
        },
        loadChart(datas, beginDate, endDate) {          //加载统计图
            var name = this.fileInfo.fileName;
            var texts = "";
            var optionValue = this.propertyInfo.proNamech;
            var Simulation_data = messages.zh.homeResultDataJsp.Simulation_data;
            if ("en" == this.locals18n) {
                optionValue = this.propertyInfo.proNameen;
                Simulation_data = messages.en.homeResultDataJsp.Simulation_data;
            }
            if (beginDate != null) {
                // console.log(this.oneMonthTime);
                if (name == "one_month") {
                    texts = this.oneMonthTime + "" + name + "   " + optionValue;
                } else {
                    texts = beginDate + ' - ' + endDate + '      ' + name + "   " + optionValue;
                }

            }
            console.log(Simulation_data);
            this.echartBegtime = beginDate;
            this.echartEndtime = endDate;
            document.getElementById("echartSpan").innerText = texts;
            this.myChart = echarts.init(document.getElementById('eChartsDiv'));
            this.myChart.clear();
            var proUnit = "";
            // if (this.propertyInfo.proUnit != null) {
            //     proUnit = this.propertyInfo.proUnit;
            // }
            this.echartsOption = {
                // title: {
                //     text:texts ,
                //     left: 'center'
                // },
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'cross'
                    }
                },
                legend: {
                    data: [Simulation_data]
                },
                xAxis: {
                    type: 'time',
                    splitLine: {
                        lineStyle: {
                            type: 'dashed'
                        }
                    },
                    splitNumber: 20,
                },
                yAxis: {
                    type: 'value',
                    splitLine: {
                        lineStyle: {
                            type: 'dashed'
                        }
                    }, axisLabel: {
                        formatter: '{value} ' + proUnit
                    }
                },
                series: [{
                    name: Simulation_data,
                    type: 'line',
                    showSymbol: false,
                    hoverAnimation: false,
                    data: datas,
                    color: ['#e42222'],
                }]
            };
            var biaozhunValue = [];
            var biaozhunTitle = [];
            // console.log(this.propertyInfo);
            //proRed: "[+∞,0.06]"
            var red = this.propertyInfo.proRed;
            if (red.indexOf("&") != -1) {
                red = red.split("&")[0];
            }
            if (typeof red == "undefined" || red == null || red == "") {
                // console.log("无最大值");
            } else {
                if (red.indexOf("∞") == -1) {
                    //不存在最大值和最小值
                    var maxmin = red.substring(1, red.length - 1).split(",");
                    biaozhunValue.push(maxmin[0]);
                    biaozhunTitle.push("max");
                    biaozhunValue.push(maxmin[1]);
                    biaozhunTitle.push("min");
                } else {
                    var redmax = red.split("+∞,");
                    if (redmax.length > 1) {
                        var maxValue = redmax[1].substring(0, redmax[1].indexOf("]"));
                        biaozhunValue.push(maxValue);
                        biaozhunTitle.push("max");
                    }
                    var redmin = red.split(",-∞]");
                    if (redmin.length > 1) {
                        var minValueelse = redmin[redmin.length - 2];
                        var minValue = minValueelse.substring(minValueelse.lastIndexOf("[") + 1, minValueelse.length);
                        biaozhunValue.push(minValue);
                        biaozhunTitle.push("min");
                    }
                }
            }
            var biaozunJson = this.biaozunFormate(biaozhunValue, biaozhunTitle, datas[0]);
            // console.log(biaozunJson);
            for (let i = 0; i < biaozunJson.length; i++) {
                if(!this.dynamicVisible){
                    this.echartsOption.series.push(biaozunJson[i]);
                }
            }

            this.myChart.setOption(this.echartsOption);
        },
        biaozunFormate(valueArray, TilteArray, datas1) { //标准线的生成
            var biaozun = [];
            for (let i = 0; i < valueArray.length; i++) {
                var timesData = datas1;
                var reuslt = {
                    name: TilteArray[i],
                    type: 'line',
                    data: [[datas1[0], valueArray[i]]],
                    markLine: {
                        data: [{
                            name: TilteArray[i] + '（' + valueArray[i] + ")",
                            yAxis: valueArray[i],
                            label: {
                                formatter: '{b}',
                                show: true
                            }
                        }],
                    }, color: ['#E6A23C'],
                };
                biaozun.push(reuslt);
            }
            return biaozun;
        },
        addElseData(datasChart, observation_dat, lineType, colors) {
            //添加额外数据
            //datasChart【数据】,observation_dat【名字】,lineType【类别，线还是点】,colors【颜色】
            this.echartsOption.legend.data.push(observation_dat);
            var addserver = {
                name: observation_dat,
                type: lineType,
                data: datasChart,
                color: [colors],
                showSymbol: false,
                hoverAnimation: false,
            };
            this.echartsOption.series.push(addserver);
            this.myChart.setOption(this.echartsOption);
        },
        addHardward() {
            //现在改为 显示图层列表
            this.layerChangeVisible = true;

            //添加统计数据
            // if (this.fileOptionValue != "" && this.siteTypeOptionValue != "" && this.tierOptionValue != "" && this.siteOptionValue != "") {
            //     if (this.siteOptionValue == "DM3") {
            //         var beginRtime = "";
            //         var endRtime = "";
            //
            //         if (this.dateValue == null) {
            //             beginRtime = this.echartBegtime;
            //             endRtime = this.echartEndtime;
            //         } else {
            //             beginRtime = this.common.getTime(this.dateValue[0], "Y");
            //             endRtime = this.common.getTime(this.dateValue[1], "Y");
            //         }
            //         this.$http.get('/hardware/getHarewaredData.do?pre=' + this.siteTypeOptionValue + "&begDate=" + beginRtime + "&endDate=" + endRtime, {emulateJSON: true}).then(function (res) {
            //             if (res.data.length != 0) {
            //                 var datasChart = this.fromatTimeDataGC(res.data);
            //                 // console.log(datasChart);
            //                 var messageNoData = "暂未根据目前条件查询到观测数据";
            //                 var observation_dat = messages.zh.homeResultDataJsp.observation_dat;
            //                 if ("en" == this.locals18n) {
            //                     optionValue = this.propertyInfo.proNameen;
            //                     observation_dat = messages.en.homeResultDataJsp.observation_dat;
            //                     messageNoData = "No observation data has been queried according to the current conditions";
            //                 }
            //                 this.addElseData(datasChart, observation_dat, "scatter", "#0cbdd7")
            //             } else {
            //                 this.$message({
            //                     message: messageNoData,
            //                     type: 'error'
            //                 });
            //             }
            //         });
            //     } else {
            //         this.$message({
            //             message: '目前只有DM3的数据',
            //             type: 'error'
            //         });
            //     }
            // }
        },
        fromatTableData(data, pageNo) {
            //格式化数据到表格
            var beginNo = (pageNo - 1) * 10;
            var datas = [];
            var lengt = 0;
            if (beginNo + 10 > data.length) {
                lengt = data.length;
            } else {
                lengt = beginNo + 10
            }
            for (let i = beginNo; i < lengt; i++) {
                datas.push(data[i]);
            }
            return datas;
        },
        handleCurrentChange(val) {
            //分页的跳转
            this.tableData = this.fromatTableData(this.allData, val);
        },
        timeWhile() {
            //自动Play
            setInterval(function () {
                if (em.palyFlose == 1) {
                    em.timePlayValue++
                }
            }, 1000)
        },
        timeplayFunction() {
            //Play按钮
            if (this.timePlayTitle == "Play") {
                this.timePlayTitle = "Pause";
                this.iconData = "el-icon-video-pause";
                this.palyFlose = 1;
            } else {
                this.timePlayTitle = "Play";
                this.iconData = "el-icon-video-play";
                this.palyFlose = 0;
            }
        },
        loadImaget(timeTemp) {
            // console.log("查询图片");
            //加载图片
            this.$http.get('/readMap/queryMapPic.do?mapId=' + this.fileOptionValue + "&code=" + this.siteTypeOptionValue + "&queryTime=" + timeTemp, {emulateJSON: true}).then(function (res) {
                this.closeLoading();
                if (res.data.code == 1) {
                    var pathString = res.data.entity.mapPicPath;
                    // pathString=pathString.replace(/\\/g,"**");
                    var host = "http://" + window.location.host + "/home/readPartImage.do?address=" + res.data.entity.mapPicName + "&FilePath=" + encodeURIComponent(pathString);
                    this.imageSrc = host;
                } else {
                    this.$message({
                        message: res.data.message,
                        type: 'error'
                    });
                }

            });
        },
        reloadImage() {
            console.log(this.timeValueBegin);
            if (this.timeValueBegin != 0) {
                this.timePage = 1;//切换到第一页
                this.timePlayValue = 1;   //切换到第一个
                this.timeMarks(); //重新加载进度条
                //重新加载数据
                var timeTemp = this.timeValueBegin + ((this.timePlayValue - 1) * 1000 * 60 * 60 + ((this.timePage - 1) * 12 * 1000 * 60 * 60));
                this.loadImaget(timeTemp);
            }
        },
        timeMarks() {
            var maks = {};
            for (var i = 0; i < this.timeEndHour; i++) {
                //这个值应该等于     （page-1）
                // console.log(this.timeValueBegin + ((i - 1) * 1000 * 60 * 60 + ((this.timePage - 1) * 12 * 1000 * 60 * 60)));
                maks[i] = this.common.getTime(this.timeValueBegin + ((i - 1) * 1000 * 60 * 60 + ((this.timePage - 1) * 12 * 1000 * 60 * 60)), "H");

            }
            this.marks = maks;
            // this.marks.pa(1,"11")
        },
        fromatTimeDataGC(date) {
            var data = [];
            for (let i = 0; i < date.length; i++) {
                var now = new Date(date[i].dataTime);
                var value = date[i].dataValue;
                var jjson = [now, value];
                data.push(jjson);
            }
            return data;
        },
        formatTooltip(val) {
            var time = this.timeValueBegin + ((val - 1) * 1000 * 60 * 60 + ((this.timePage - 1) * 12 * 1000 * 60 * 60));
            var proName = "";
            if (this.propertyInfo !== null) {
                proName = this.propertyInfo.proRemark;
            }
            this.imagTitle = this.common.getTime(time) + "                               " + proName;
            return this.common.getTime(time);
        }, randomColor() {
            return '#' + Math.floor(Math.random() * 0xffffff).toString(16);
        }, loadingPic() {
            try {
                window.parent.toggleLoading();
            } catch (e) {
            }
        }, closeLoading() {
            try {
                window.parent.closeLoading();
            } catch (e) {
            }
        }, openLoading() {
            try {
                window.parent.openLoading();
            } catch (e) {
            }
        }
    }
});






